.\" Process this file with
.\" groff -man -Tascii bdep-argument-grouping.1
.\"
.TH bdep-argument-grouping 1 "June 2024" "bdep 0.17.0"
.SH NAME
\fBbdep-argument-grouping\fR \- argument grouping facility
.SH "SYNOPSIS"
.PP
\fBbdep\fR \fB{\fR \fIoptions\fR \fB}+\fR \fIargument\fR \fB+{\fR
\fIoptions\fR \fB}\fR\fR
.SH "DESCRIPTION"
.PP
For certain commands certain options and command line variables can be grouped
to only apply to specific arguments\. This help topic describes the argument
grouping facility used for this purpose\.
.PP
Groups can be specified before (leading) and/or after (trailing) the argument
they apply to\. A leading group starts with '\fB{\fR' and ends with '\fB}+\fR'
while a trailing group starts with '\fB+{\fR' and ends with '\fB}\fR'\. For
example:
.PP
.nf
{ --foo --bar }+ arg   # 'arg' with '--foo' '--bar'
arg +{ fox=1 baz=2 }   # 'arg' with 'fox=1' 'baz=2'
.fi
.PP
Multiple leading and/or trailing groups can be specified for the same
argument\. For example:
.PP
.nf
{ -f }+ { -b }+ arg +{ f=1 } +{ b=2 } # 'arg' with '-f' 'b' 'f=1' 'b=2'
.fi
.PP
The group applies to a single argument only unless multiple arguments are
themselves grouped with '\fB{\fR' and '\fB}\fR'\. For example:
.PP
.nf
{ --foo }+ arg1  arg2 +{ --bar }      # 'arg1' with '--foo'
                                      # 'arg2' with '--bar'

{ --foo }+ { arg1  arg2 } +{ --bar }  # 'arg1' with '--foo' '--bar'
                                      # 'arg2' with '--foo' '--bar'
.fi
.PP
The group separators ('\fB{\fR', '\fB}+'\fR, etc) must be separate command
line arguments\. In particular, they must not be adjacent either to the
arguments inside the group nor to the argument they apply to\. All such cases
will be treated as ordinary arguments\. For example:
.PP
.nf
{--foo}+ arg   # '{--foo}+' \.\.\.
arg+{ --foo }  # 'arg+{' \.\.\.
.fi
.PP
If one of the group separators needs to be specified as an argument verbatim,
then it must be escaped with '\fB\e\fR'\. For example:
.PP
.nf
}             # error: unexpected group separator
}x            # '}x'
\\}            # '}'
{ \\}+ }+ arg  # 'arg' with '}+'
.fi
.SH BUGS
Send bug reports to the users@build2.org mailing list.
.SH COPYRIGHT
Copyright (c) 2014-2024 the build2 authors.

Permission is granted to copy, distribute and/or modify this document under
the terms of the MIT License.
